package com.wm.gridimageupload.util

import android.app.Activity
import com.luck.picture.lib.basic.PictureSelector
import com.luck.picture.lib.config.PictureConfig
import com.luck.picture.lib.config.SelectMimeType

object PictureSelectUtils {

    fun gallery(name: String = "相机拍摄",activity: Activity) {
        when(name) {
            "相机拍摄" -> {
                PictureSelector.create(activity)
                    .openCamera(SelectMimeType.ofImage())
                    .forResultActivity(PictureConfig.CHOOSE_REQUEST)
            }
            "从相册选择" -> {
                PictureSelector.create(activity)
                    .openGallery(SelectMimeType.ofImage())
                    .setImageEngine(GlideEngine.createGlideEngine())
                    .setMaxSelectNum(8)
                    .setMinSelectNum(1)
                    .setImageSpanCount(4)
                    .forResult(PictureConfig.CHOOSE_REQUEST)
            }
        }
    }

}